package practice.练习ConcurrentHashMap;

import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

public class MyConcurrentHashMap {
    public static void main(String[] args) {
        ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>();
        map.put("zhangsan","23");
        map.put("lisi","24");
        map.put("wangwu","22");
        map.put("zhaoliu","25");
        map.put("shiqi","26");

        Set<Map.Entry<String, String>> entries = map.entrySet();
        for (Map.Entry<String, String> entry : entries) {
            System.out.println(entry.getKey()+"="+entry.getValue());
        }
        System.out.println("===================");
        ConcurrentHashMap.KeySetView<String, String> keySet = map.keySet();
        for (String s : keySet) {

            System.out.println(s+"="+map.get(s));
        }
    }
}
